﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Kaleta.Xna.Debug;
using Kaleta.Xna.Timing;
using Kaleta.Network;

namespace Kaleta.Outcast.Debuging
{
    public static class DebugUpdater
    {
        static public void Update(GameTime gameTime)
        {
            Timer.Run("Update.Statistics.Network", gameTime, 1000.0f, delegate()
            {
                if (DistributionSession.Server != null)
                {
                    Debugger.SetValue("Server bandwitch[B/s] sent/recieved", (DistributionSession.Server.Statistics.BytesSent).ToString()
                        + "/" + (DistributionSession.Server.Statistics.BytesReceived).ToString());
                    DistributionSession.Server.Statistics.Reset();
                }
                if (DistributionSession.Client != null)
                {
                    Debugger.SetValue("Client bandwitch[B/s] sent/recieved", (DistributionSession.Client.Statistics.BytesSent).ToString()
                            + "/" + (DistributionSession.Client.Statistics.BytesReceived).ToString());
                    DistributionSession.Client.Statistics.Reset();
                }
            });

            Timer.Run("Update.Debug", gameTime, 1000.0f, delegate()
            {
                Debugger.TimeLastUpdate = gameTime.ElapsedGameTime.TotalMilliseconds;
            });
        }

        
    }
}
